package per.sunmes.cl.g.data.cards;

import per.sunmes.cl.g.actor.Card;
import per.sunmes.cl.g.actor.Player;
import per.sunmes.cl.g.actor.Zone;
import per.sunmes.cl.g.data.CardEffect;
import per.sunmes.cl.g.data.type.Direction;
import per.sunmes.cl.g.i.CallBack;
import per.sunmes.cl.g.screen.GameScreen;

import com.badlogic.gdx.scenes.scene2d.Group;

public class CardEffect6 implements CardEffect {
	@Override
	public void effect(GameScreen gameScreen, Zone selfZone, Card cardSelf) {
		selfCardMoveLandEffect(gameScreen, selfZone, cardSelf, new CallBack() {
			@Override
			public void call() {
				selfZone.setCard(cardSelf);
				Player player = cardSelf.getPlayer();
				validZone(gameScreen, selfZone, player);
				for (Direction direct : Direction.CORNER) {
					validZone(gameScreen, selfZone.getSurround(direct), player);
				}
			}
		});

		// ///
		gameScreen.delayActionExecuteNextRound(0.4f);
	}

	@Override
	public void preEffect(GameScreen gameScreen, Zone selfZone, Card cardSelf,
			Group previewGroup) {
		preEffectCardSelfLand(gameScreen, selfZone, cardSelf, previewGroup);
		Player player = cardSelf.getPlayer();
		for (Direction direct : Direction.CORNER) {
			preEffectCardLand(gameScreen, selfZone.getSurround(direct), player,
					previewGroup);
		}
	}

	@Override
	public boolean isCouldPutToZone(Zone zone) {
		return zone.getCard() == null;
	}

}
